#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<stack>

using namespace std;

int clumsy(int n) {
    stack<int> stk;
    stk.push(n);
    n--;

    int idx = 0;
    while (n > 0)
    {
        if (idx % 4 == 0)
            stk.top() *= n;
        else if (idx % 4 == 1)
            stk.top() /= n;
        else if (idx % 4 == 2)
            stk.push(n);
        else
            stk.push(-n);
        idx++;
        n--;
    }

    int res = 0;
    while (!stk.empty())
    {
        res += stk.top();
        stk.pop();
    }
    return res;
}